using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MMM.Core.Domain;
using ServiceStack.ServiceHost;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using MMM.Services.Base;
using MMM.Services.Operations;
using MMM.Services.Type;

namespace MMM.Services
{
    /// <summary>
    /// 类描述 基础服务类(POST,PUT)
    /// </summary>
    public class ContractManageService : BaseService<ContractManage>
    {
    }
    /// <summary>
    /// 类描述 服务类(GET)
    /// </summary>
    public class ContractManageGetSerice : BaseGetService<ContractManagePageGet, ContractManage>
    {
        //protected override System.Linq.Expressions.Expression<Func<ContractManage, bool>> CreateFilter(ContractManagePageGet request)
        //{
        //    return base.CreateFilter(request);
        //}
        protected override string CreateFilter(ContractManagePageGet request)
        {
            string sql = string.Empty;
            IList<Filter> lst = request.GetFilter();
            if (lst != null)
            {
                foreach (var item in lst)
                {
                    if (item.Property == "SignDateTime")
                    {
                        if (string.IsNullOrWhiteSpace(sql))
                        {
                            sql = item.ToSqlEque();
                        }
                        else
                        {
                            sql = string.Format(" {0} and {1} ", sql, item.ToSqlEque());
                        }
                    }
                    else
                    {
                        if (string.IsNullOrWhiteSpace(sql))
                        {
                            sql = item.ToSqlLike();
                        }
                        else
                        {
                            sql = string.Format(" {0} and {1} ", sql, item.ToSqlLike());
                        }
                    }
                }
            }

            return sql;
        }
    }
    /// <summary>
    /// 类描述 服务类(DELETE)
    /// </summary>
    public class ContractManageDeleteService : BaseDeleteService<ContractManage, ContractManageDelete>
    {
    }
}
